import { useState } from "react"
const Input = props => {

    let [todo, setTodo] = useState("")
    function change(e) {
        setTodo(e.target.value)



    }
    function click(e) {
        if (e.keyCode === 13) {
            props.abc(todo)
            setTodo(e.target.value = "")
        }
    }
    return (
        <fieldset>
            <legend>todolist案例</legend>
            <h1>toDoList <input type="text" value={todo} onChange={change} onKeyDown={click} /></h1>

        </fieldset>
    )
}
export default Input